<html>
<script type="text/javascript" src="testcode.js"></script>
<script>
    // needed in case we arrive here via a client redirect
    if (window.testRunner)
        testRunner.notifyDone();
</script>
<body id="testbody" style="font-size: 32">
This is test page that has a secure form.  It is part of a test to show that form state is restored during back/forward navigations.
<br><br>
<div id="console">Test Passed</div>
<form id="testform" action="https://127.0.0.1:8443/navigation/resources/test.html" method="post">
    <input type="submit" name="submitwithpost" value="Submit with POST"/><br>
    <input type="submit" name="submitwithpostredirect" value="Submit with POST followed by a redirect"/><br>
    <input type="text" name="textfield1" id="tf" value="Test Failed"/><br>
    <input type="text" name="textfield2" value=""/><br>
    <input type="radio" name="radiogroup1" id="radiooption1" value="male"/><br>
    <input type="radio" name="radiogroup1" id="radiooption2" value="female"/><br>
    <input type="checkbox" name="checkbox1"/><br>
    <input type="checkbox" name="checkbox2"/><br>
    <select name="selectgroup1">
    <option value="volvo"/>Initial Value
    <option value="saab"/>foo
    <option value="fiat"/>Value set by User that should be Restored
    <option value="audi"/>bar
    </select>
    <br>
    <textarea name="textarea1" rows="10" cols="30" value="Initial text before user input">More initial text before user input.</textarea>
</form>
<script>
function checkControlState() {
  testRunner.waitUntilDone();
  setTimeout(() => {
    if (document.getElementById('tf').value == "New form text from user")
      document.getElementById('console').innerHTML = "Test Passed";
    else
      document.getElementById('console').innerHTML = "Test Failed";
    testRunner.notifyDone();
  }, 1);
};
</script>
</body>
</html>
